<template>
	<view style="height: 100%" class="my">
		<top title="我的" color="#fff" bgc="transparent" :show="2" position="absolute"></top>
		<image src="https://cdn.xtwaixie.com/uploads/20240705/17201802276687de03b75ed.png" class="home-bg h270"></image>
		<view class="pr mt5">
			<view class="df" v-if="info.nickname">
				<button type="balanced" open-type="chooseAvatar" @chooseavatar="onChooseavatar"
					style="width: 120rpx;height: 120rpx;border: 5rpx solid #fff !important;border-radius: 50%;">
					<image referrerPolicy='no-referrer' :src="getImgSrc(info.avatar)"
						style="width: 120rpx;height: 120rpx;border-radius: 50%;">
					</image>
				</button>
				<view class="ml15">
					<view class="f24 f600 cf w200 ovh" @tap="changeName" style="width: 285rpx;">{{ info.nickname }}
					</view>
					<p class="f14 cf ml10">ID:{{ info.id }}</p>
				</view>
				<!-- <navigator class="df ac jc edit-but ml10"
					:url="'/pages/my/editInfo?name=' + info.username + '&company=' + info.company + '&mobile=' + info.company_tel + '&email=' + info.email">
					<image class="img16" src="https://wx.xtwaixie.com/img/edit1.png" mode="aspectFit|aspectFill|widthFix"
						:lazy-load="false" @error="" @load=""></image>
					<p class="f12 cf ml6">编辑企业信息</p>
				</navigator> -->
			</view>
			<view class="df ac" v-else @tap="goLogin">
				<image class="txs mr15" src="https://cdn.xtwaixie.com/uploads/20240705/17201782376687d63d0c294.png" />
				<button class="login-but">点击登录账号</button>
			</view>
			<view :class="'my-numinfo-box mt20 df ' + (info.grade == 0 ? 'jc' : '')+'  heightauto '">
				<view class="w50 df sb fc" v-if="info.grade == 0">
					<view class="">
						<h2 class="tc db f18 cf f600">入驻供应商</h2>
						<p class="mt5 tc db f12 cff8 db">获取3次报价次数</p>
					</view>
					<navigator class="settled-but" url="/pages/settled/setPage" open-type="navigate">立即入驻</navigator>
				</view>
				<view class="w50 tc df jc fc ac heightauto" v-else-if="info.grade == 1">
					<image class="img50" src="https://cdn.xtwaixie.com/uploads/20240705/17201802276687de0375783.png">
					</image>
					<p class="f18 cf f600 db tc mt3">优选供应商</p>
					<p class="f10 cf db tc mt2 companyName widtheight">{{ address.company }}</p>
				</view>
				<view class="w50 tc df jc fc ac" v-else-if="info.grade == 2" @tap="goVip" style="position: relative;">
					<image class="img50" src="https://cdn.xtwaixie.com/uploads/20240705/17201802276687de0394e88.png">
					</image>
					<p class="f18 cf f600 db tc mt3">会员供应商</p>
					<p class="f10 cf op6 db tc mt2">{{ info.vip_end_at }}到期</p>
					<!-- <image src="https://cdn.xtwaixie.com/uploads/20240705/17201782366687d63cc82a9.png" v-if='showVip'
						mode="widthFix" style="position: absolute;width: 200rpx;top: -56rpx;right: -36rpx;"></image> -->
				</view>
				<p class="numinfo-line"></p>
				
				<view class="w50 df sb fc rBox" v-if="info.grade == 0">
					<view class="">
						<h2 class="tc db f1f op6 cf" style="font-size: 30rpx;">报价次数剩余</h2>
						<p class="mt5 tc db f22 cf db" style="font-size: 36rpx;">{{ info.free_number }}<text
								style="font-size: 30rpx;">次</text></p>
					</view>
					<!-- 					<view class="df ac jc">
						<navigator class="recharge-but" v-if="platform != 'ios'" url="/pages/recharge/recharge"
							open-type="navigate">充值</navigator>
						<navigator class="recharge-but recharge-but1" v-if="platform != 'ios'" url="/pages/my/integral"
							open-type="navigate">明细</navigator>
						<button open-type="contact" class="customer" v-if="platform == 'ios'">联系客服</button>
					</view> -->
				</view>
				<view class="w50 df sb fc rBox" v-else-if="info.grade == 1">
					<view class="">
						<h2 class="tc db f1f op6 cf" style="font-size: 30rpx;">报价次数剩余</h2>
						<p class="mt5 tc db f22 cf db" style="font-size: 36rpx;">{{ info.free_number }}<text
								style="font-size: 30rpx;">次</text></p>
					</view>
					
					<view class="settled-but" v-if="!info.number_receive" @tap="onReceive"
						style="margin-top: 20rpx;border-radius:10rpx ;width: 250rpx;"> 点击免费领取3次 
					</view>
					
					<view class="settled-but1" v-else @tap="goVip"
						style="margin-top: 20rpx;border-radius:10rpx ;width: 250rpx;height:auto;">
						<image src="https://cdn.xtwaixie.com/uploads/20240705/17201782366687d63cc82a9.png"
							mode="widthFix"></image> 升级会员供应商
					</view>
				</view>
				<view class="w50 df sb fc rBox" v-else-if="info.grade == 2">
					<view class="">
						<h2 class="tc db f1f op6 cf" style="font-size: 30rpx;">{{ address.company }}</h2>
						<p class="mt5 tc db f22 cf db" style="font-size: 36rpx;">{{ address.province }}
							{{ address.city }}
						</p>
					</view>
				</view>
			</view>
			<!--  -->
			<view class="" v-if="!is_order_box">
				<view class="bgcf br12 pd150 mt12">
					<view class="df ac sb pd015">
						<P class="f16 f600">供应商管理</P>
					</view>
					<ul class="df ac  mt15">
						<view class="tc pr" style="width: 33.33%;"
							@click="receivedQuotation(info.nickname ? '/pages/myQuotation/myQuotation' : '/pages/login/login')">
							<image class="img24"
								src="https://cdn.xtwaixie.com/uploads/20240705/17201782366687d63c70ef5.png" />
							<p class="db f12 c6b tc mt3">我的报价<text class="numbox"
									v-if="demandCount.count4">({{ demandCount.count4 }})</text></p>
						</view>
						<navigator class="tc pr" :url="info.nickname ? url : '/pages/login/login'" hover-class="none"
							open-type="navigate" style="width: 33.33%;position: relative;">
							<image class="img24"
								src="https://cdn.xtwaixie.com/uploads/20240705/17201782366687d63ce3b86.png" />
							<p class="db f12 c6b tc mt3" style="white-space: nowrap;">企业资料管理</p>
							<image src="https://cdn.xtwaixie.com/uploads/20240416/1713231546661dd6ba22970.gif"
								mode="widthFix" style="position: absolute;width: 150rpx;height: auto;left: 50%;top: -50%;"
								v-if="info.grade!=0 && detailUrl != '/pages/companyDetail/companyDetail?id=' + info.id">
							</image>
						</navigator>
						<navigator class="tc pr" :url="info.nickname ? detailUrl : '/pages/login/login'" hover-class="none"
							open-type="navigate" style="width: 33.33%;">
							<image class="img24"
								src="https://cdn.xtwaixie.com/uploads/20240705/17201802276687de035accd.png" />
							<p class="db f12 c6b tc mt3" style="white-space: nowrap;">企业资料展示</p>
						</navigator>
					</ul>
				</view>
				<view class="bgcf br12 pd150 mt12">
					<view class="df ac sb pd015">
						<P class="f16 f600">采购管理</P>
					</view>
					<ul class="df ac  mt15">
						<view class="tc pr" style="width: 33.33%;" @click="receivedQuotation('/pages/myInquiry/myInquiry')">
							<image class="img24"
								src="https://cdn.xtwaixie.com/uploads/20240705/17201782366687d63cac16b.png" />
							<p class="db f12 c6b tc mt3">我的询价<text class="numbox"
									v-if="demandCount.count1">({{ demandCount.count1 }})</text></p>
						</view>
						<view class="tc pr" style="width: 33.33%;"
							@click="receivedQuotations('/pages/receivedQuotation/receivedQuotation')">
							<image class="img24"
								src="https://cdn.xtwaixie.com/uploads/20240705/17201782366687d63c554a7.png" />
							<p class="db f12 c6b tc mt3" style="white-space: nowrap;">已获报价<text class="numbox"
									v-if="demandCount.count2">({{ demandCount.count2 }})</text></p>
							<p class="dot-num" v-if="demandCount.count3">{{ demandCount.count3 }}</p>
						</view>
						<!-- 					<navigator  url=""
							hover-class="none" open-type="navigate">
				
						</navigator> -->
						<navigator class="tc pr " style="width: 33.33%;"
							:url="'/pages/my/editInfo?name=' + info.username + '&company=' + info.company + '&mobile=' + info.company_tel + '&email=' + info.email + '&nickname=' + info.nickname"
							hover-class="none" open-type="navigate">
							<image class="img24"
								src="https://cdn.xtwaixie.com/uploads/20240705/17201782366687d63c8c87b.png" />
							<p class="db f12 c6b tc mt3" style="white-space: nowrap;">联系信息</p>
						</navigator>
					</ul>
				</view>
			</view>
			<view class="" v-else>
				<view class="bgcf br12 pd150 mt12">
					<view class="df ac sb pd015">
						<P class="f16 f600">采购管理</P>
					</view>
					<ul class="df ac  mt15">
						<view class="tc pr" style="width: 33.33%;" @click="receivedQuotation('/pages/myInquiry/myInquiry')">
							<image class="img24"
								src="https://cdn.xtwaixie.com/uploads/20240705/17201782366687d63cac16b.png" />
							<p class="db f12 c6b tc mt3">我的询价<text class="numbox"
									v-if="demandCount.count1">({{ demandCount.count1 }})</text></p>
						</view>
						<view class="tc pr" style="width: 33.33%;"
							@click="receivedQuotations('/pages/receivedQuotation/receivedQuotation')">
							<image class="img24"
								src="https://cdn.xtwaixie.com/uploads/20240705/17201782366687d63c554a7.png" />
							<p class="db f12 c6b tc mt3" style="white-space: nowrap;">已获报价<text class="numbox"
									v-if="demandCount.count2">({{ demandCount.count2 }})</text></p>
							<p class="dot-num" v-if="demandCount.count3">{{ demandCount.count3 }}</p>
						</view>
						<!-- 					<navigator  url=""
							hover-class="none" open-type="navigate">
				
						</navigator> -->
						<navigator class="tc pr " style="width: 33.33%;"
							:url="'/pages/my/editInfo?name=' + info.username + '&company=' + info.company + '&mobile=' + info.company_tel + '&email=' + info.email + '&nickname=' + info.nickname"
							hover-class="none" open-type="navigate">
							<image class="img24"
								src="https://cdn.xtwaixie.com/uploads/20240705/17201782366687d63c8c87b.png" />
							<p class="db f12 c6b tc mt3" style="white-space: nowrap;">联系信息</p>
						</navigator>
					</ul>
				</view>
				<view class="bgcf br12 pd150 mt12">
					<view class="df ac sb pd015">
						<P class="f16 f600">供应商管理</P>
					</view>
					<ul class="df ac  mt15">
						<view class="tc pr" style="width: 33.33%;"
							@click="receivedQuotation(info.nickname ? '/pages/myQuotation/myQuotation' : '/pages/login/login')">
							<image class="img24"
								src="https://cdn.xtwaixie.com/uploads/20240705/17201782366687d63c70ef5.png" />
							<p class="db f12 c6b tc mt3">我的报价<text class="numbox"
									v-if="demandCount.count4">({{ demandCount.count4 }})</text></p>
						</view>
						<navigator class="tc pr" :url="info.nickname ? url : '/pages/login/login'" hover-class="none"
							open-type="navigate" style="width: 33.33%;position: relative;">
							<image class="img24"
								src="https://cdn.xtwaixie.com/uploads/20240705/17201782366687d63ce3b86.png" />
							<p class="db f12 c6b tc mt3" style="white-space: nowrap;">企业资料管理</p>
							<image src="https://cdn.xtwaixie.com/uploads/20240416/1713231546661dd6ba22970.gif"
								mode="widthFix" style="position: absolute;width: 150rpx;height: auto;left: 50%;top: -50%;"
								v-if="info.grade!=0 && detailUrl != '/pages/companyDetail/companyDetail?id=' + info.id">
							</image>
						</navigator>
						<navigator class="tc pr" :url="info.nickname ? detailUrl : '/pages/login/login'" hover-class="none"
							open-type="navigate" style="width: 33.33%;">
							<image class="img24"
								src="https://cdn.xtwaixie.com/uploads/20240705/17201802276687de035accd.png" />
							<p class="db f12 c6b tc mt3" style="white-space: nowrap;">企业资料展示</p>
						</navigator>
					</ul>
				</view>
			</view>
			<view class="bgcf br12 pd150 mt12">
				<view class="df ac sb pd015">
					<P class="f16 f600">商城订单</P>
					<navigator class="df ac" :url="info.nickname ? '/pages/myOrder/orderList' : '/pages/login/login'"
						hover-class="none" open-type="navigate">
						<p class="f12 c9d">全部订单</p>
						<image class="more ml8" src="https://wx.xtwaixie.com/img/more.png" />
					</navigator>
				</view>
				<ul class="df ac sa mt15">
					<navigator class="tc pr"
						:url="info.nickname ? '/pages/myOrder/orderList?act=1' : '/pages/login/login'"
						hover-class="none" open-type="navigate">
						<image class="img24" src="https://wx.xtwaixie.com/img/o1.png" />
						<p class="db f12 c6b tc mt3">待付款</p>
						<p class="dot-num" v-if="orderCount.count1">{{ orderCount.count1 }}</p>
					</navigator>
					<navigator class="tc pr"
						:url="info.nickname ? '/pages/myOrder/orderList?act=2' : '/pages/login/login'"
						hover-class="none" open-type="navigate">
						<image class="img24" src="https://wx.xtwaixie.com/img/o2.png" />
						<p class="db f12 c6b tc mt3">待发货</p>
						<p class="dot-num" v-if="orderCount.count2">{{ orderCount.count2 }}</p>
					</navigator>
					<navigator class="tc pr"
						:url="info.nickname ? '/pages/myOrder/orderList?act=3' : '/pages/login/login'"
						hover-class="none" open-type="navigate">
						<image class="img24" src="https://wx.xtwaixie.com/img/o3.png" />
						<p class="db f12 c6b tc mt3">待收货</p>
						<p class="dot-num" v-if="orderCount.count3">{{ orderCount.count3 }}</p>
					</navigator>
					<navigator class="tc pr"
						:url="info.nickname ? '/pages/myOrder/orderList?act=5' : '/pages/login/login'"
						hover-class="none" open-type="navigate">
						<image class="img24" src="https://wx.xtwaixie.com/img/o4.png" />
						<p class="db f12 c6b tc mt3">已完成</p>
						<p class="dot-num" v-if="orderCount.count4">{{ orderCount.count4 }}</p>
					</navigator>
					<navigator class="tc pr" :url="info.nickname ? '/pages/myOrder/returnList' : '/pages/login/login'"
						hover-class="none" open-type="navigate">
						<image class="img24" src="https://wx.xtwaixie.com/img/o5.png" />
						<p class="db f12 c6b tc mt3">退货/售后</p>
						<p class="dot-num" v-if="orderCount.count5">{{ orderCount.count5 }}</p>
					</navigator>
				</ul>
			</view>
			<!--            <view class="bgcf br12 pd150 mt12">
                <view class="df ac sb pd015">
                    <P class="f16 f600">联系我们</P>
                </view>
                <ul class="df ac sa mt15">
                    <navigator class="tc pr w20" url="/pages/purchase/purchase" hover-class="none" open-type="navigate">
                        <image class="img24" src="https://wx.xtwaixie.com/img/o6.png" />
                        <p class="db f12 c6b tc mt3">采购管理</p>
                    </navigator>
                    
                    <navigator class="tc pr w20" url="/pages/share/shareList" hover-class="none" open-type="navigate">
                        <image class="img24" src="https://wx.xtwaixie.com/img/o8.png" />
                        <p class="db f12 c6b tc mt3">分享提交</p>
                    </navigator>
                    
                    <navigator class="tc pr w20" url="/pages/supplier/supplier" hover-class="none" open-type="navigate">
                        <image class="img24" src="https://wx.xtwaixie.com/img/o10.png" />
                        <p class="db f12 c6b tc mt3">商城供应商</p>
                    </navigator>
                </ul>
            </view> -->
			<view class="bgcf br12 pd150 mt12">
				<view class="df ac sb pd015">
					<P class="f16 f600">联系我们</P>
				</view>
				<ul class="df ac mt15" style="flex-wrap: wrap;">
					<button class="tc pr kf-but1" open-type="contact">
						<image class="img24" src="https://wx.xtwaixie.com/img/kf2.png" />
						<p class="db f12 c6b tc mt3 f400">平台客服</p>
					</button>
					<navigator class="tc pr w20"
						:url="info.nickname ? '/pages/address/addressList?type=1' : '/pages/login/login'"
						hover-class="none" open-type="navigate">
						<image class="img24" src="https://wx.xtwaixie.com/img/o7.png" />
						<p class="db f12 c6b tc mt3">收货及发票</p>
					</navigator>
					<button class="tc pr ma0 pd0 w20" open-type="contact">
						<image class="img24" src="https://wx.xtwaixie.com/img/o9.png" />
						<p class="db f12 c6b tc mt3 f400">广告合作</p>
					</button>
					<navigator class="tc pr" url="/pages/share/qrshare" hover-class="none" open-type="navigate">
						<image class="img24" src="https://wx.xtwaixie.com/img/pack.png" />
						<p class="db f12 c6b tc mt3">采购工具包</p>
					</navigator>
					<navigator class="tc pr w20" url="/pages/help/help" hover-class="none" open-type="navigate">
						<image class="img24" src="https://wx.xtwaixie.com/img/o12.png" />
						<p class="db f12 c6b tc mt3">帮助中心</p>
					</navigator>
					<navigator class="tc pr w20" url="/pages/qualifications/qualifications" hover-class="none"
						open-type="navigate" style="margin-top: 20rpx;">
						<image class="img24" src="https://wx.xtwaixie.com/img/o10.png" />
						<p class="db f12 c6b tc mt3" style="white-space: nowrap;">平台资质公示</p>
					</navigator>
				</ul>
			</view>
			<!-- <view class='mt12 bgcf br12 pd015'>
    <navigator class="df ac sb h48 bbf1" url="/pages/my/integral" hover-class="none" open-type="navigate">
      <p class='f14 c28'>我的积分</p>
      <image class="more2" src="../../img/more.png" />
    </navigator>
    <navigator class="df ac sb h48 bbf1" url="/pages/address/addressList?type=1" hover-class="none" open-type="navigate">
      <p class='f14 c28'>收货地址及开票信息</p>
      <image class="more2" src="../../img/more.png" />
    </navigator>
    <navigator class="df ac sb h48 bbf1" url="/pages/share/shareList" hover-class="none" open-type="navigate">
      <p class='f14 c28'>分享提交</p>
      <image class="more2" src="../../img/more.png" />
    </navigator>
    <button class="df ac sb h48 bbf1 w100 ma0 pd0" open-type='contact'>
      <p class='f14 c28 f400'>广告合作</p>
      <image class="more2" src="../../img/more.png" />
    </button>
    <navigator class="df ac sb h48" url="/pages/supplier/supplier" hover-class="none" open-type="navigate">
      <p class='f14 c28'>成为刀具供应商</p>
      <image class="more2" src="../../img/more.png" />
    </navigator>
  </view>
  <view class='mt12 bgcf br12 pd015'>
    <button class="df ac sb h48 bbf1 w100 f400 pd0" open-type='contact'>
      <p class='f14 c28'>联系客服</p>
      <image class="more2" src="../../img/more.png" />
    </button>
    <view class="df ac sb h48 bbf1" bindtap='showPopup'>
			<p class='f14 c28'>联系客服</p>
			<image class="more2" src="../../img/more.png" />
		</view>
    <navigator class="df ac sb h48 bbf1" url="/pages/about/about?type=1" hover-class="none" open-type="navigate">
			<p class='f14 c28'>联系客服</p>
			<image class="more2" src="../../img/more.png" />
		</navigator>
    <navigator class="df ac sb h48 bbf1" url="/pages/about/about?type=2" hover-class="none" open-type="navigate">
      <p class='f14 c28'>隐私政策</p>
      <image class="more2" src="../../img/more.png" />
    </navigator>
    <navigator class="df ac sb h48 bbf1" url="/pages/about/about?type=3" hover-class="none" open-type="navigate">
      <p class='f14 c28'>免责声明</p>
      <image class="more2" src="../../img/more.png" />
    </navigator>
    <navigator class="df ac sb h48 bbf1" url="/pages/about/about?type=4" hover-class="none" open-type="navigate">
      <p class='f14 c28'>服务条款</p>
      <image class="more2" src="../../img/more.png" />
    </navigator>
    <navigator class="df ac sb h48 bbf1" url="/pages/about/about?type=5" hover-class="none" open-type="navigate">
      <p class='f14 c28'>法律声明</p>
      <image class="more2" src="../../img/more.png" />
    </navigator>
    <navigator class="df ac sb h48 bbf1" url="/pages/about/about?type=6" hover-class="none" open-type="navigate">
      <p class='f14 c28'>知识产权申明</p>
      <image class="more2" src="../../img/more.png" />
    </navigator>
    <navigator class="df ac sb h48 bbf1" url="/pages/about/about?type=7" hover-class="none" open-type="navigate">
      <p class='f14 c28'>常见问题</p>
      <image class="more2" src="../../img/more.png" />
    </navigator>
    <navigator class="df ac sb h48" url="/pages/about/about?type=8" hover-class="none" open-type="navigate">
      <p class='f14 c28'>积分规则及权益</p>
      <image class="more2" src="../../img/more.png" />
		</navigator>
		
			<button class="tc pr w20" bindtap='showPopup'>
				<image class="img24" src="../../img/kf2.png" />
				<p class='db f12 c6b tc mt3'>平台客服</p>
			</button>
  </view> -->
		</view>
		<!-- <van-popup show="{{ show }}" closeable round bind:close="onClose">
	<view class='code-box'>
		<h2 class='f16 c28 f600 db tc'>联系客服</h2>
		<image class="ewm" src="{{base_info.service_qrcode}}" />
		<button class="bc-but" bindtap='saveImage'>保存二维码</button>
		<p class='f14 c9d db tc'>打开微信扫码添加客服</p>
		<p class='f14 c9d df ac jc'>
			或拨打电话
			<span class='f500 c10' bindtap='onCall' data-tel='{{base_info.service_tel}}'>
				{{base_info.service_tel}}
			</span>
		</p>
	</view>
</van-popup> -->
		<van-popup :show="showRequest" custom-style='background:#00000000;'>
			<image src="https://cdn.xtwaixie.com/uploads/20240108/1704702779659bb33b1136b.png" mode="widthFix"
				style="width: 450rpx;padding-bottom: 800rpx;"></image>
		</van-popup>
		<model :value='showTips' title='提示' content="恭喜您已获得3次查看联系方式机会" :showdisagreeBtn='false' agreeBtn='确认'
			@change='changeTips()' @agree='confirmSale' color='#1A4FBF' />
		<van-popup :show="infoShow" round @close="infoShow = false">
			<p class="df ac jc pd200 mt5 w311">
				<span class="f16 c28 f500">请完善公司资料信息</span>
			</p>
			<view class="df ac btf1 h48 mt15">
				<p class="w50 tc f16 c28" @tap.native="infoShow = false">取消</p>
				<button class="share-but1 h48 c10" @tap="goSettledInfo">去完善</button>
			</view>
		</van-popup>
		<tabbar></tabbar>
	</view>
</template>
<script>
	import model from '@/component/model';
	import tabbar from '@/component/tabbar/tabbar';
	import top from '@/component/top/top';
	const http = require('../../utils/http');
	export default {
		components: {
			tabbar,
			top,
			model
		},
		data() {
			return {
				detailUrl: '/pages/editSettled/editSettled',
				show: false,
				info: {
					nickname: '',
					avatar: '',
					id: '',
					username: '',
					company: '',
					mobile: '',
					email: '',
					grade: 0,
					vip_end_at: '',
					current_integral: ''
				},
				url: '/pages/editSettled/editSettled',
				showTips: false,
				get_number: true,
				avatarUrl: '',
				base_info: {},
				orderCount: {
					count1: '',
					count2: '',
					count3: '',
					count4: '',
					count5: ''
				},
				platform: '',
				address: '',
				demandCount: {},
				infoDetail: {},
				showVip: false,
				showRequest: false,
				infoShow: false,
				is_order_box:false,
			};
		},
		onLoad(options) {
			this.getBase();
			let obj = uni.getSystemInfoSync();
			this.setData({
				platform: obj.platform
			});
		},
		/**
		 * 生命周期函数--监听页面初次渲染完成
		 */
		onReady() {},
		/**
		 * 生命周期函数--监听页面显示
		 */
		onShow() {
			let token = uni.getStorageSync('token');
			if (token) {
				this.getUserInfo();
			}
		},
		/**
		 * 生命周期函数--监听页面隐藏
		 */
		onHide() {},
		/**
		 * 生命周期函数--监听页面卸载
		 */
		onUnload() {},
		/**
		 * 页面相关事件处理函数--监听用户下拉动作
		 */
		onPullDownRefresh() {},
		/**
		 * 页面上拉触底事件的处理函数
		 */
		onReachBottom() {},
		/**
		 * 用户点击右上角分享
		 */
		onShareAppMessage() {},
		methods: {
			changeName() {
				uni.navigateTo({
					url: "/pages/changeName/changeName?name=" + this.info.nickname
				})
			},
			// receivedQuotations(index) {
			// 	uni.requestSubscribeMessage({
			// 		tmplIds: ['5SQbIg20NgfTt5-y7GY8BRzxqvrinsp-GnKzQIPcNPo',
			// 			'VFzK9QykUmGyTn9YRVHrxmihxNELMsUhJxvTWnhNHa8'
			// 		],
			// 		complete(res) {
			// 			uni.navigateTo({
			// 				url: index
			// 			})
			// 		}
			// 	})
			// },
			receivedQuotations(index) {
				uni.requestSubscribeMessage({
					tmplIds: ['5SQbIg20NgfTt5-y7GY8BRzxqvrinsp-GnKzQIPcNPo'],
					complete(res) {
						uni.navigateTo({
							url: index
						})
					}
				})
			},
			receivedQuotation(index) {
				uni.navigateTo({
					url: index
				})
			},
			onChooseavatar(e) {
				let self = this;
				let {
					avatarUrl
				} = e.detail;
				uni.showLoading({
					title: '加载中'
				});
				http.upLoadFile('base/uploadImg', 'image', avatarUrl, {}).then((ress) => {
					if (ress.code == 200) {
						http.request('user/updateAvatar', {
							avatar: ress.data.url
						}).then((res) => {
							self.info.avatar = ress.data.url
							uni.hideLoading();
							uni.showToast({
								title: "修改成功"
							});
						}).catch((res) => {
							uni.showToast({
								title: res.message,
								icon: 'none'
							});
						});
					}
				}).catch((res) => {
					uni.hideLoading();
					uni.showToast({
						title: res.message,
						icon: 'none'
					});
				});
			},
			goSettledInfo() {
				uni.navigateTo({
					url: '/pages/Factoryinformation/Factoryinformation'
				});
			},
			// 获取个人信息
			getUserInfo() {
				http.request('user/userInfo').then((res) => {
					// if(res.data.userInfo.mobile==''){
					// 	wx.showToast({
					// 			title: "您还未登录，请先登录",
					// 			icon: "none",
					// 			duration: 1000,
					// 		});
					// 	setTimeout(() => {
					// 		wx.navigateTo({
					// 			url: "/pages/login/login",
					// 		});
					// 	}, 1000);
					// }else{
					// }
					uni.setStorageSync('is_info', res.data.is_info);
					
					this.setData({
						info: res.data.userInfo,
						orderCount: res.data.orderCount,
						demandCount: res.data.demandCount
					});
					if(this.info.grade != 0){
						this.is_order_box = true
					}
					
					if (!this.info.nickname) {
						this.info.nickname = '微信用户'
					}
					if (this.info.grade == 2) {
						let vip_end_at = `${this.info.vip_end_at} 23:59:59`
						if ((new Date(vip_end_at) - new Date()) / (1 * 24 * 60 * 60 * 1000) <= 30) {
							this.showVip = true
						} else {
							this.showVip = false
						}
					}
					if (!res.data.userInfo.settledStatus) {
						this.url = '/pages/editSettled/editSettled'
					} else {
						this.url = '/pages/Factoryinformation/Factoryinformation'
					}
					if (this.info.grade !== 0) {
						http.request('user/settledInfo').then((res) => {
							this.address = res.data.info
							this.settledStatus=res.data.info.settledStatus
							
							if (!this.info.settledStatus) {
								console.log(this.info.settledStatus);
								this.detailUrl = '/pages/editSettled/editSettled'
								console.log(1);
							} else {
								if (this.address.detail && this.address.detail.status == 2) {
									this.detailUrl = '/pages/companyDetail/companyDetail?id=' + this.info
										.id
								} else {
									this.detailUrl = '/pages/Factoryinformation/Factoryinformation'
								}
							}
						}).catch((res) => {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							});
						});
					}
				}).catch((res) => {
					uni.showToast({
						title: res.message,
						icon: 'none'
					});
				});
			},
			onReceive() {
				if (!this.info.settledInfoStatus) {
					// this.infoShow = true
					this.receive()
					// this.$forceUpdate()
				} else {
					this.receive()
				}
				// const _this = this
				// uni.getUserProfile({
				// 	desc: '用于完善会员资料',
				// 	success: (res) => {
				// 		console.log(res);
				// 		_this.receive({
				// 			avatar: res.userInfo.avatarUrl,
				// 			nickname: res.userInfo.nickName,
				// 			sex: res.userInfo.gender == 0 ? '' : (res.userInfo
				// 				.gender == 1 ? '女' : '男'),
				// 			region: res.userInfo.province + res.userInfo.city
				// 		});
				// 	},
				// 	fail: (res) => {
				// 		_this.receive()
				// 	}
				// });
				return
				uni.getProvider({
					service: "oauth",
					success: function(res) {
						console.log(res)
						if (~res.provider.indexOf("weixin")) {
							uni.getUserProfile({
								desc: "获取你的昵称",
								success: (res) => {
									//这里请求接口
									_this.receive({
										nickname: res.userInfo.nickName
									});
								},
								fail: (res) => {
									// _this.receive()
								},
							});
						} else {
							// _this.receive()
						}
					},
				});
			},
			changeTips() {
				this.showTips = false
			},
			confirmSale() {
				this.showTips = false
			},
			receive(data = {}) {
				let first = uni.getStorageSync("firstPopup")
				if (!first) {
					this.showRequest = true
					uni.setStorageSync('firstPopup', true)
				}
				let popupTime = uni.getStorageSync('popupTime');
				if (popupTime) {
					let nowDate = new Date().setHours(0, 0, 0, 0)
					if (nowDate > popupTime) {
						let that = this
						uni.requestSubscribeMessage({
							tmplIds: ['Ps_TGNHTlkFPLHybskEltaWoAvSZ1GhsoXfiJBGwTjA'],
							success(res) {
								if (res.Ps_TGNHTlkFPLHybskEltaWoAvSZ1GhsoXfiJBGwTjA == 'accept') {
									http.request('demand/empower')
									uni.setStorageSync('popupTime', new Date().getTime())
								}
								that.showRequest = false
								http.request('user/receive', data).then((res) => {
									that.getUserInfo()
									that.showTips = true
									setTimeout(() => {
										that.showTips = false
									}, 2000);
								}).catch((res) => {
									uni.showToast({
										title: res.message,
										icon: 'none'
									});
								});
							}
						})
					} else {
						let that = this
						that.showRequest = false
						http.request('user/receive', data).then((res) => {
							that.getUserInfo()
							that.showTips = true
							setTimeout(() => {
								that.showTips = false
							}, 2000);
						}).catch((res) => {
							uni.showToast({
								title: res.message,
								icon: 'none'
							});
						});
					}
				} else {
					let that = this
					uni.requestSubscribeMessage({
						tmplIds: ['Ps_TGNHTlkFPLHybskEltaWoAvSZ1GhsoXfiJBGwTjA'],
						success(res) {
							if (res.Ps_TGNHTlkFPLHybskEltaWoAvSZ1GhsoXfiJBGwTjA == 'accept') {
								http.request('demand/empower')
								uni.setStorageSync('popupTime', new Date().getTime())
							}
							that.showRequest = false
							http.request('user/receive', data).then((res) => {
								that.getUserInfo()
								that.showTips = true
								setTimeout(() => {
									that.showTips = false
								}, 2000);
							}).catch((res) => {
								uni.showToast({
									title: res.message,
									icon: 'none'
								});
							});
						}
					})
				}
			},
			goVip() {
				uni.navigateTo({
					url: '/pages/recharge/recharge'
				});
				// if (this.platform === 'ios') {
				// 	uni.navigateTo({
				// 		url: '/pages/recharge/iosvip'
				// 	});
				// } else {
				// 	uni.navigateTo({
				// 		url: '/pages/recharge/recharge'
				// 	});
				// }
			},
			getBase() {
				http.request('base/configData').then((res) => {
					this.setData({
						base_info: res.data
					});
				}).catch((res) => {
					console.log(res);
				});
			},
			showPopup() {
				this.setData({
					show: true
				});
			},
			// onClose() {
			// 	this.setData({
			// 		show: false
			// 	});
			// },
			// 撥打電話
			onCall(e) {
				let tel = e.currentTarget.dataset.tel;
				uni.makePhoneCall({
					phoneNumber: tel,
					complete() {
						this.onClose();
					}
				});
			},
			// 保存图片
			saveImage() {
				let that = this;
				uni.showLoading({
					title: '保存中...',
					mask: true
				});
				uni.downloadFile({
					url: that.base_info.service_qrcode,
					success(res) {
						if (res.statusCode === 200) {
							let img = res.tempFilePath;
							uni.saveImageToPhotosAlbum({
								filePath: img,
								success(res) {
									uni.showToast({
										title: '保存成功',
										icon: 'success',
										duration: 2000
									});
									that.onClose();
								},
								fail(res) {
									that.onClose();
									uni.showToast({
										title: '保存失败',
										icon: 'none',
										duration: 2000
									});
								}
							});
						}
					}
				});
			},
			goLogin() {
				uni.navigateTo({
					url: '/pages/login/login'
				});
			}
		}
	};
</script>
<style lang="scss">
	@import './my.css';

	.settled-but {
		font-family: PingFangSC, PingFangSC-Regular;
		font-weight: bold;
	}

	.rBox {
		display: flex;
		height: 176rpx;
		align-items: center;
		flex-direction: column;
		justify-content: center;
	}

	.companyName {
		font-size: 24rpx;
		opacity: .8;
		// overflow: hidden;
		/*   超出容器的部分影响  */
		// white-space: nowrap;
		/*  文本不换行   */
		// text-overflow: ellipsis;
		/*  超出容器的文本显示省略号  */
		height: auto;
		text-align: center;
	}

	.numbox {
		color: #65C27D;
	}

	.heightauto {
		height: auto;
	}

	.widtheight {
		width: 80%;
		margin: auto;
		height: auto;
		word-break: break-all;
	}

	.share-but1 {
		width: 50% !important;
		font-size: 32rpx;
		padding: 0 !important;
		margin: 0 !important;
		font-weight: 400;
		text-align: center;
		color: #283043;
		line-height: 94rpx !important;
		border-left: 1rpx solid #ebedf0;
	}
</style>